﻿#ifndef __SS_MSG_ID_DEF_H__
#define __SS_MSG_ID_DEF_H__
#include "../ssBaseDefine.h"

//0~99保留id
//100~199 一级ID

//100以内不能用于自定义
#define SS_THREAD_STOP			1
#define SS_THREAD_DEL			2
#define SS_THREAD_CLEAR			3
//网络ID
#define SS_MSG_DISCONNECT		100			//网络连接中断
#define SS_MSG_NEW_CONNECT		101			//网络新连接
#define SS_MSG_RECRIVE			102			//网络收到消息
#define SS_MSG_SEND				103			//网络发送消息
#define SS_MSG_CLOSE			105			//主动断开连接
#define SS_MSG_NULL_RESP		106			//不要回包
#define SS_MSG_BROADCAST		107			//网络发送广播
#define SS_MSG_THREAD			120			//线程间消息
//计时器ID
#define SS_TIMER_HALF_HOUR		130			//每半点整点触发
#define SS_TIMER_DEL			131			//删除计时器
#define SS_TIMER_REPEAT			132			//重复性计时器基数
#define SS_TIMER_ONCE			133			//一次性计时器基数

//自定义消息基数
#define SS_MSG_ID_USER			0x10000000

//线程间消息结构
namespace StarSeeker
{
	//线程间消息结构
	struct ssMsg_s
	{
		u32 msgID;
		u32 subID;
		ulint param[3];

		ssMsg_s()
		{
			msgID = 0;
			subID = 0;
			param[0] = param[1] = param[2] = 0;
		}
		ssMsg_s(u32 mi, u32 si, ulint p1=0, ulint p2=0, ulint p3=0)
		{
			msgID = mi;
			subID = si;
			param[0] = p1;
			param[1] = p2;
			param[2] = p3;
		}
	};

	//计时器消息结构
	struct ssTimer_s : public ssMsg_s
	{
		u64 timestamp;
		u32 interval;

		ssTimer_s()
		{
			timestamp = 0;
			interval = 0;
		}
		bool operator < (const ssTimer_s& t)
		{
			return this->timestamp < t.timestamp;
		}
		bool operator > (const ssTimer_s& t)
		{
			return this->timestamp > t.timestamp;
		}
		bool operator <= (const ssTimer_s& t)
		{
			return this->timestamp <= t.timestamp;
		}
		bool operator >= (const ssTimer_s& t)
		{
			return this->timestamp >= t.timestamp;
		}
	};
}


#endif
